import { configureStore } from "@reduxjs/toolkit";

import { loginApi } from "./request/loginrequest";

import loginslice from "./slice/loginslice";
import tabSlice from "./slice/tabslice";


import { registerApi } from "./request/registerrequest";
import { accountApi } from "./request/accountrequest";
import { dataCleanPropsApi } from "./request/dataworksrequests/datacleanpropsrequest";
import { mileagecombinePropsApi } from "./request/dataworksrequests/mileagecombinepropsrequest";
import { halfhourcombinePropsApi } from "./request/dataworksrequests/halfhourcombinepropsrequest";
import { txtcombinePropsApi } from "./request/dataworksrequests/txtcombinepropsrequest";
import { spikeremovePropsApi } from "./request/dataworksrequests/spikeremovepropsrequest";
import { publicPropsApi } from "./request/dataworksrequests/publicpropsrequest";
import { systemVersionApi } from "./request/systemversionrequest";
import { dataMileageCheckPropsApi } from "./request/dataworksrequests/datamileagecheckpropsrequest";
import { dataPredictPropsApi } from "./request/dataworksrequests/datapredictpropsrequest";
import { dataConvertcsviPropsApi } from "./request/dataworksrequests/dataconvertcsvipropsrequest";
import { dataLinearConvertPropsApi } from "./request/dataworksrequests/datalinearconvertpropsrequest";
import { PropsHalfHourCalApi } from "./request/dataworksrequests/userpropshalfhourcalrequest";
import { unifyPropsApi } from "./request/dataworksrequests/unifypropsrequest";
import { PropsMileageCalApi } from "./request/dataworksrequests/userpropsmileagecalrequest";
import { dataLSTMPredictApi } from "./request/dataworksrequests/datalstmpredictrequest";
import { dbcMessageTransferApi } from "./request/dataworksrequests/dbcmessagetransferrequest";

const store = configureStore({
    reducer: {
        //属性名需要中括号
        [loginApi.reducerPath]: loginApi.reducer,
        [registerApi.reducerPath]: registerApi.reducer,
        [accountApi.reducerPath]: accountApi.reducer,
        [dataCleanPropsApi.reducerPath]: dataCleanPropsApi.reducer,
        [spikeremovePropsApi.reducerPath]: spikeremovePropsApi.reducer,
        [mileagecombinePropsApi.reducerPath]: mileagecombinePropsApi.reducer,
        [halfhourcombinePropsApi.reducerPath]: halfhourcombinePropsApi.reducer,
        [txtcombinePropsApi.reducerPath]: txtcombinePropsApi.reducer,
        [publicPropsApi.reducerPath]: publicPropsApi.reducer,
        [systemVersionApi.reducerPath]: systemVersionApi.reducer,
        [dataMileageCheckPropsApi.reducerPath]: dataMileageCheckPropsApi.reducer,
        [dataPredictPropsApi.reducerPath]:dataPredictPropsApi.reducer,
        [dataConvertcsviPropsApi.reducerPath]:dataConvertcsviPropsApi.reducer,
        [dataLinearConvertPropsApi.reducerPath]:dataLinearConvertPropsApi.reducer,
        [PropsHalfHourCalApi.reducerPath]:PropsHalfHourCalApi.reducer,
        [PropsMileageCalApi.reducerPath]:PropsMileageCalApi.reducer,
        [unifyPropsApi.reducerPath]:unifyPropsApi.reducer,
        [dataLSTMPredictApi.reducerPath]:dataLSTMPredictApi.reducer,
        [dbcMessageTransferApi.reducerPath]:dbcMessageTransferApi.reducer,
        //loginpara这个名称是给组件调用useSelector（state=>{state.loginpara}）时使用
        loginpara: loginslice.reducer,
        tabpara: tabSlice.reducer

    },
    middleware: getDefaultMiddleware =>
        getDefaultMiddleware({
            //由于redux会检查有没有存储无法序列化的变量，如函数，组件等，有就会报错，但是可以让他忽略此检查，由于tab的children需要传组件，所以需要忽略
            // serializableCheck: {
            //     // Ignore these action types
            //     ignoredActions: ['tab/addtabitemState'],
            //     // Ignore these field paths in all actions
            //     ignoredActionPaths: ['meta.arg', 'payload.children'],
            //     // Ignore these paths in the state
            //     ignoredPaths: ['tabpara'],
            //   },
        }).concat(loginApi.middleware).concat(registerApi.middleware)
            .concat(accountApi.middleware)
            .concat(dataCleanPropsApi.middleware).concat(halfhourcombinePropsApi.middleware)
            .concat(mileagecombinePropsApi.middleware).concat(spikeremovePropsApi.middleware)
            .concat(txtcombinePropsApi.middleware).concat(halfhourcombinePropsApi.middleware)
            .concat(publicPropsApi.middleware).concat(systemVersionApi.middleware)
            .concat(dataMileageCheckPropsApi.middleware).concat(dataPredictPropsApi.middleware)
            .concat(dataConvertcsviPropsApi.middleware).concat(dataLinearConvertPropsApi.middleware)
            .concat(PropsHalfHourCalApi.middleware).concat(unifyPropsApi.middleware)
            .concat(PropsMileageCalApi.middleware).concat(dataLSTMPredictApi.middleware)
            .concat(dbcMessageTransferApi.middleware),

});
//store 只能默认导出
export default store;